﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;

namespace webapi.Models
{
  public class SelectedService
  {
    static public DataRowCollection getAllStudentCourse()
    {
      string sql = "select c.name, b.course_id, a.class_course_id, c.point, c.is_must, d.name, d.user_id, b.day, b.time, b.start, b.last from select_course as a join set_up_course as b on a.class_course_id = b.class_course_id join course as c on b.course_id = c.course_id join [user] as d on d.user_id = a.stu_id";
      DataSet ds = DB.ExecuteSelectSql(sql);
      return DB.ExecuteSelectSql(sql).Tables[0].Rows;
    }

    static public DataRowCollection getStudentCourseById(string id) {
      string sql = "select c.name, b.course_id, a.class_course_id, c.point, c.is_must, d.name, d.user_id, b.day, b.time, b.start, b.last from select_course as a join set_up_course as b on a.class_course_id = b.class_course_id join course as c on b.course_id = c.course_id join [user] as d on d.user_id = a.stu_id where a.stu_id ='" + id + "'";
      DataSet ds = DB.ExecuteSelectSql(sql);
      return DB.ExecuteSelectSql(sql).Tables[0].Rows;
    }
  }
}